<?php
/*
 * [JINYUN!] (C)2001-2099 Jinyunweb.com
 * This is NOT a freeware, use is subject to license terms
 *订单管理
*/
defined('BY_JYA') or exit('error');
$_RQ['op']=$_RQ['op']?$_RQ['op']:'list';
$return=array();
$return['status']=$this->team_status;
$return['noping']=$this->noping;
$tabs=array(
	array('op'=>'list','title'=>'全部树'),
); 
if($_RQ['op']=='list'){
	$return['params']=array();
	$params=array('uniacid'=>$_SESSION['uniacid'],'bossmid'=>0);
	//我的团
	//先查询我的订单
	$pindex = max(1, intval($_RQ['page']));
	if($_RQ['psize']){
		$_SESSION['psize']=$_RQ['psize'];
	}
	$psize = $_SESSION['psize']?:10;
	$list=pdo_getslice('jy_pingpaifee_team',$params,array($pindex,$psize),$total,$fields,'','id desc');
	if($list){
		foreach($list as $k=>&$item){
			$item['member']=cfc('core')->member_show($item['mid']);
			$item['isnum']=pdo_count('jy_pingpaifee_team',array('uniacid'=>$_SESSION['uniacid'],'bossmid'=>$item['mid']));
			$item['bosslevel']++;
		}
	}
	$return['list']=$list;
	$totalpage=ceil($total/$psize);
	$totalpage=intval($totalpage);
	$return['totalpage'] =$totalpage;
	$return['params']['page'] =$pindex;
	$htmls=array(
		'type'=>'list',
		'tabs'=>$tabs,
		'list'=>array('data'=>'list','total'=>$total,'psize'=>$psize,'edit'=>false,'del_one'=>false,'delall'=>false,'list'=>array(
			array('name'=>'member','title'=>'种树人','type'=>'member'),
			array('name'=>'bosslevel','title'=>'第几轮','type'=>'string'),
			array('name'=>'isnum','title'=>'已参与团数','type'=>'string'),
			array('name'=>'status','title'=>'状态','type'=>'radio','options'=>'status'),
			array('name'=>'createtime','title'=>'时间','type'=>'time'),
		),'action'=>array(
			array('type'=>'href','action'=>'jy_pingpaifee/team/','title'=>'参与团'),
		)),
		'search'=>array(
			array('name'=>'id','title'=>'团ID','type'=>'string','width'=>15),
		)
	);
	$return['status']=array('未成团','已成团');	
	$return['htmls']=$htmls;	
	exi($return);
}
